package com.lxhotel.agentmcp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lxhotel.agentmcp.domain.response.UserBookingResponse;
import com.lxhotel.agentmcp.entity.UserBooking;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface UserBookingMapper extends BaseMapper<UserBooking> {

    @Select("SELECT\n" +
            "ub.*,\n" +
            "hrti.hotelRoomTypeId,\n" +
            "hrt.hotelId,\n" +
            "hrt.price,\n" +
            "hrt.roomParam,\n" +
            "hrt.roomTypeName,\n" +
            "hrt.facility,\n" +
            "h.hotelName,\n" +
            "h.hotelNameEn,\n" +
            "h.hotelNameShort,\n" +
            "h.province,\n" +
            "h.city,\n" +
            "h.district,\n" +
            "h.starRating,\n" +
            "h.openDate,\n" +
            "h.renovationDate,\n" +
            "h.roomNum,\n" +
            "h.businessDistrict,\n" +
            "h.address,\n" +
            "h.tel,\n" +
            "h.amapLatitude,\n" +
            "h.amapLongitude,\n" +
            "h.baiduLatitude,\n" +
            "h.baiduLongitude,\n" +
            "h.totalComment,\n" +
            "h.overallRating,\n" +
            "h.healthRating,\n" +
            "h.envRating,\n" +
            "h.serviceRating,\n" +
            "h.facilityRating,\n" +
            "h.hotelSellingPoints,\n" +
            "h.videoBulletComments,\n" +
            "h.honorTag,\n" +
            "h.qualityAssurance,\n" +
            "h.hotelPopularFacilities,\n" +
            "h.hotelFacilities,\n" +
            "h.hotelPolicy,\n" +
            "h.hotelDescription,\n" +
            "h.traffic,\n" +
            "h.lowestRoomTypePrice,\n" +
            "h.openingDate,\n" +
            "h.basicRoomTypeList \n" +
            "FROM\n" +
            "user_booking ub\n" +
            "LEFT JOIN hotel_room_type_inventory hrti ON ub.hotelRoomTypeInventoryId = hrti.id\n" +
            "LEFT JOIN hotel_room_type hrt ON hrti.hotelRoomTypeId = hrt.id\n" +
            "LEFT JOIN hotel h ON h.id = hrt.hotelId \n" +
            "WHERE\n" +
            "ub.userId =#{userId}")
    List<UserBookingResponse> selectUserBookingList(Long userId);
}
